#-------------------------------------------------------------------------------
# Name:        VectorCompare
# Purpose:
#
# Author:      EVOB
#
# Created:     13.07.2014
# Copyright:   (c) EVOB 2014
# Licence:     <your licence>
#-------------------------------------------------------------------------------
import math

class VectorCompare:
    def magnitude(self,concordance):
        total = 0
        for word,count in concordance.iteritems():
            total += count ** 2
        return math.sqrt(total)

    def relation(self,concordance1, concordance2):
        relevance = 0
        topvalue = 0
        for word, count in concordance1.iteritems():
            if concordance2.has_key(word):
                topvalue += count * concordance2[word]
        return topvalue / (self.magnitude(concordance1) * self.magnitude(concordance2))

    def buildvector(self, im):
      d1 = {}
      count = 0
      for i in im.getdata():
        d1[count] = i
        count += 1
      return d1


def main():
    pass

if __name__ == '__main__':
    main()
